package com.sihan.swvp.service.sys;

import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sihan.swvp.common.CommonUtil;
import com.sihan.swvp.dao.sys.LogDao;

@Service
public class LogService {
	@Autowired
	private LogDao logDao;
	
	public void addUserLog(String title,String mark,long cruser,String content,String ipaddr, int success,int type){
		
		logDao.addUserLog(title, mark, content, cruser,ipaddr,success,type);
	}
	
	public void delUserLog(int id){
		logDao.delUserLog(id);
	}
	
	public void delUserLogs(int[] ids){
		logDao.delUserLogs(ids);
	}
	
	public Page<Map<String,Object>> getUserLog(Integer page,Integer limit,Map<String,Object> params){
		PageHelper.startPage(page, limit);
		return logDao.getUserLog(params);
	}
	
	
	public void addSystemLog(String title,String mark,long cruser,String...content){
		
		logDao.addSystemLog(title, mark, CommonUtil.connectMsg(content), cruser);
	}
	
	public void delSystemLog(int id){
		logDao.delSystemLog(id);
	}
	
	public void delSystemLogs(int[] ids){
		logDao.delSystemLogs(ids);
	}
	
	public Page<Map<String,Object>> getSystemLog(Integer page,Integer limit,Map<String,Object> params){
		PageHelper.startPage(page, limit);
		return logDao.getSystemLog(params);
	}
}
